import { Vector2 } from 'three';
import { Point2D } from '../Point2D';
import ThreeApp, { WinEvent } from '../ThreeApp';
import Controller from './Controller';

export default class DrawController extends Controller {
  constructor() {
    super();
    this.addEvent(WinEvent.onmousedown, (e) => {
      this.mousedown(e.event, e.worldPosition);
    });
  }

  public mousedown(event: MouseEvent, worldPos: Vector2): void {
    // console.log('mouseDouwn', this, event, worldPos);
    const point = new Point2D(worldPos);
    ThreeApp.viewManager.addViewObject(point);
  }
}
